﻿//====================================================================
// Create by Daniel
// file： YCUser.cs
// project ：YunCMS
// Build time：2012-09-06
// modify:
// description:
// ===================================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;

using YunCMS.BLL;
using YunCMS.Model;

public partial class YCUserManage : System.Web.UI.Page
{
    private const int PAGE_SIZE = 10;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

        }
    }


    protected void saveBt_Click(object sender, EventArgs e)
    {
        YCUserBLL bll = new YCUserBLL();
        YCUser model = new YCUser();
        model.UserAccount = UserAccountTB.Text.Trim();
        model.Password = PasswordTB.Text.Trim();
        model.Email = EmailTB.Text.Trim();
        model.Telephone = TelephoneTB.Text.Trim();
        model.Name = NameTB.Text.Trim();
        model.Deactive = System.Convert.ToBoolean(DeactiveRB.SelectedValue);
        if (UpdateTimeTB.Text.Trim() != "")
            model.UpdateTime = System.Convert.ToDateTime(UpdateTimeTB.Text.Trim());
        else
            model.UpdateTime = System.Convert.ToDateTime("0001-1-1");
        if (LoginTimesTB.Text.Trim() != "")
            model.LoginTimes = System.Convert.ToInt32(LoginTimesTB.Text.Trim());
        else
            model.LoginTimes = 0;
        model.Gender = System.Convert.ToBoolean(GenderRB.SelectedValue);
        if (LastLoginTB.Text.Trim() != "")
            model.LastLogin = System.Convert.ToDateTime(LastLoginTB.Text.Trim());
        else
            model.LastLogin = System.Convert.ToDateTime("0001-1-1");
        model.OtherInfo = OtherInfoTB.Text.Trim();
        model.Dept = DeptTB.Text.Trim();
        if (RoleTB.Text.Trim() != "")
            model.Role = System.Convert.ToInt32(RoleTB.Text.Trim());
        else
            model.Role = 0;
        bll.Add(model);
        //Response.Redirect("YCUser.aspx");
    }
    protected void cancelBt_Click(object sender, EventArgs e)
    {
        //Response.Redirect("YCUser.aspx");
    }
}




